package io.lkt.modules.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lkt.common.util.Query;
import io.lkt.common.utils.PageUtils;
import io.lkt.modules.sys.dao.BTeamInfoDao;
import io.lkt.modules.sys.entity.BTeamInfoEntity;
import io.lkt.modules.sys.service.BTeamInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

@Service("bTeamInfoService")
public class BTeamInfoServiceImpl extends ServiceImpl<BTeamInfoDao, BTeamInfoEntity> implements BTeamInfoService {
    @Autowired
    private BTeamInfoDao bTeamInfoDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Query query = new Query(params);
        List<BTeamInfoEntity> list = bTeamInfoDao.queryTeamInfo(query);
        Integer total = bTeamInfoDao.queryTeamInfoTotal(query);
        PageUtils page = new PageUtils(list, total, query.getLimit(), query.getPage());
        return page;
    }

    @Override
    public void update(BTeamInfoEntity entity) {
        entity.setUpdateTime(new Date());
        bTeamInfoDao.updateById(entity);
    }

    @Override
    public void deleteBatch(Long[] teamIds) {
        bTeamInfoDao.deleteBatchIds(Arrays.asList(teamIds));
    }
}
